package org.anderground.app.view.dialogs;

import android.content.Context;
import android.content.DialogInterface;

/**
 * @author Eldar Abusalimov (eldar.abusalimov@gmail.com)
 */
public class FilesDialog extends ItemsDialog<String> {

	/**
	 * public constructor
	 * 
	 * @param context
	 */
	public FilesDialog(Context context) {
		super(context);
	}

	@Override
	public void onClick(DialogInterface dialog, int button) {
		if (dialog == this.getDialog()) {
			switch (button) {
			case DialogInterface.BUTTON1:
				((Listener) listener).onDownloadButtonClick(this);
				break;

			default:
				break;
			}
		}
		super.onClick(dialog, button);
	}

	/**
	 * subscribe to notifications
	 * 
	 * @param listener
	 *            the listener
	 */
	public void setListener(Listener listener) {
		if (listener != null) {
			this.listener = listener;
		}
	}

	/**
	 * Listener interface.
	 * 
	 * @author Eldar Abusalimov (eldar.abusalimov@gmail.com)
	 */
	public interface Listener extends ItemsDialog.Listener {

		public void onDownloadButtonClick(BaseDialog dialog);

	}

}
